package com.yunji.base.business;

import com.yunji.base.domain.StaffSiteDO;
import com.yunji.base.dto.StaffSiteQueryDTO;
import com.yunji.base.service.StaffSiteService;
import com.yunji.common.base.BaseBusiness;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.user.business
 * @Title: StaffSiteBusiness
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-06-28 14:03:53      V1.0        HuaAo       新建类
 */
@Component
public class StaffSiteBusiness extends BaseBusiness {


    @Resource
    StaffSiteService staffSiteService;

    /**
     * 查询员工站点列表信息
     *
     * @param staffSite
     * @return
     */
    public List<StaffSiteDO> search(StaffSiteQueryDTO staffSite) {
        return staffSiteService.search(staffSite);
    }

    /**
     * 获取员工站点详细信息
     *
     * @param id
     * @return
     */
    public StaffSiteDO select(Long id) {
        return staffSiteService.select(id);
    }

    /**
     * 新增员工站点失败
     *
     * @param staffSite
     */
    public Long create(StaffSiteDO staffSite) {
        Assert.isTrue(staffSiteService.create(staffSite), "新增失败");
        return staffSite.getId();
    }

    /**
     * 修改员工站点关联
     *
     * @param staffSite
     */
    public void update(StaffSiteDO staffSite) {
        Assert.isTrue(staffSiteService.update(staffSite), "修改失败");
    }

    /**
     * 删除员工站点失败
     *
     * @param ids
     */
    public void delete(Long[] ids) {
        Assert.isTrue(staffSiteService.delete(Arrays.asList(ids)), "删除失败");
    }
}